<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="bill" />
        <cc:attribute name="duplicate" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>

        <h:outputStylesheet library="css" name="pharmacypos.css" ></h:outputStylesheet>
        <div class="posbill">

            <div class="institutionName">
                <h:outputLabel value="#{cc.attrs.bill.department.printingName}" />
            </div>
            <div class="institutionContact" >
                <div>
                    <h:outputLabel value="#{cc.attrs.bill.department.address}"/>
                </div>
                <div >
                    <h:outputLabel value="#{cc.attrs.bill.department.telephone1} "/>
                    <h:outputLabel value="#{cc.attrs.bill.department.telephone2}"/>
                </div>
                <div >
                    <h:outputLabel value="#{cc.attrs.bill.department.fax}"/>                                                 
                </div>
            </div>

            <div class="headingBill">
                <h:outputLabel value="Sale Bill"   />    
                <h:outputLabel value="**Duplicate**"  rendered="#{cc.attrs.duplicate eq true}" /> 
                <h:outputLabel value="**Cancelled**"  rendered="#{cc.attrs.bill.cancelled eq true}" /> 
            </div>

            <div class="billline">
                <h:outputLabel value="-----------------------------------------------"   />                           
            </div>

            <div class="billDetails" >
                <table style="width: 100%;" >
                    <tr>
                        <td style="width: 15%; text-align: left;" >
                            <h:outputLabel value="Date" class="billDetails" ></h:outputLabel>
                        </td>
                        <td>:</td>
                        <td style="width: 30%" >
                            <!--<h:outputLabel value=": &npsp;" ></h:outputLabel>-->
                            <h:outputLabel value="#{cc.attrs.bill.createdAt}" class="billDetails" >
                                <f:convertDateTime pattern="dd/MM/yy" ></f:convertDateTime>
                            </h:outputLabel>
                        </td>
                        <td style="width: 10%" >

                        </td>
                        <td style="width: 15%" >
                            <!--<h:outputLabel value="Time" ></h:outputLabel>-->
                        </td>

                        <td style="width: 30%" >
                            <!--<h:outputLabel value=": &npsp;" ></h:outputLabel>-->
                            <h:outputLabel value="#{cc.attrs.bill.createdAt}" class="billDetails">
                                <f:convertDateTime pattern="hh:mm a" ></f:convertDateTime>
                            </h:outputLabel>
                        </td>

                    </tr>


                    <tr>
                        <td style="width: 15% ;text-align: left;" >
                            <h:outputLabel value="Inv.No" ></h:outputLabel>
                        </td>
                        <td>:</td>
                        <td style="width: 30%;" >
                            <!--<h:outputLabel value=": &npsp;" ></h:outputLabel>-->
                            <h:outputLabel value="#{cc.attrs.bill.deptId}"  >
                            </h:outputLabel>
                        </td>
                        <td style="width: 10%" >

                        </td>
                        <td style="width: 15%" >
                            <!--<h:outputLabel value="User" ></h:outputLabel>-->
                        </td>

                        <td style="width: 30%" >
                            <!--<h:outputLabel value=": &npsp;" ></h:outputLabel>-->
                            <h:outputLabel value="#{cc.attrs.bill.creater.staff.code}" >
                            </h:outputLabel>
                        </td>

                    </tr>

                    <tr>
                        <td style="width: 15% ;text-align: left;" >
                            <h:outputLabel value="Methord" ></h:outputLabel>
                        </td>
                        <td>:</td>
                        <td style="width: 30%;" >
                            <!--<h:outputLabel value=": &npsp;" ></h:outputLabel>-->
                            <h:outputLabel value="#{cc.attrs.bill.paymentMethod}"  >
                            </h:outputLabel>
                        </td>
                        <td style="width: 10%" >

                        </td>
                        <td style="width: 15%" >
                            <!--<h:outputLabel value="User" ></h:outputLabel>-->
                        </td>

                        <td style="width: 30%" >
                            <!--<h:outputLabel value=": &npsp;" ></h:outputLabel>-->
<!--                            <h:outputLabel value="#{cc.attrs.bill.creater.staff.code}" >
                            </h:outputLabel>-->
                        </td>

                    </tr>

                    <h:panelGroup rendered="#{cc.attrs.bill.patient ne null}" >
                        <tr>
                            <td style="width: 15% ;text-align: left;" >
                                <h:outputLabel value="Name" ></h:outputLabel>
                            </td>
                            <td>:</td>
                            <td style="width: 30%;" >
                                <h:outputLabel value="#{cc.attrs.bill.patient.person.nameWithTitle}"  >
                                </h:outputLabel>
                            </td>
                            <td style="width: 10%" >
                            </td>
                            <td style="width: 15%" >
                            </td>
                            <td style="width: 30%" >
                            </td>
                        </tr>
                    </h:panelGroup>




                    <h:panelGroup rendered="#{cc.attrs.bill.toStaff ne null}" >
                        <tr>
                            <td style="width: 15% ;text-align: left;" >
                                <h:outputLabel value="Staff Name" ></h:outputLabel>
                            </td>
                            <td>:</td>
                            <td style="width: 30%;" >
                                <h:outputLabel value="#{cc.attrs.bill.toStaff.person.nameWithTitle}"  >
                                </h:outputLabel>
                            </td>
                            <td style="width: 10%" >
                            </td>
                            <td style="width: 15%" >
                            </td>
                            <td style="width: 30%" >
                            </td>
                        </tr>
                    </h:panelGroup>


                    <h:panelGroup rendered="#{cc.attrs.bill.toDepartment ne null}" >
                        <tr>
                            <td style="width: 15% ;text-align: left;" >
                                <h:outputLabel value="To Unit" ></h:outputLabel>
                            </td>
                            <td>:</td>
                            <td style="width: 30%;" >
                                <h:outputLabel value="#{cc.attrs.bill.toDepartment.name}"  >
                                </h:outputLabel>
                            </td>
                            <td style="width: 10%" >
                            </td>
                            <td style="width: 15%" >
                            </td>
                            <td style="width: 30%" >
                            </td>
                        </tr>
                    </h:panelGroup>

                    <h:panelGroup rendered="#{cc.attrs.bill.toInstitution ne null}" >
                        <tr>
                            <td style="width: 15% ;text-align: left;" >
                                <h:outputLabel value="Company" ></h:outputLabel>
                            </td>
                            <td>:</td>
                            <td style="width: 30%;" >
                                <h:outputLabel value="#{cc.attrs.bill.toInstitution.name}"  >
                                </h:outputLabel>
                            </td>
                            <td style="width: 10%" >
                            </td>
                            <td style="width: 15%" >
                            </td>
                            <td style="width: 30%" >
                            </td>
                        </tr>
                    </h:panelGroup>
                </table>


            </div>


            <div class="billline">
                <h:outputLabel value="-----------------------------------------------"   />                           
            </div>

            <div  >

                <table style="width: 100%;">

                    <tr>
                        <td class="totalsBlock" style="text-align: left; width: 60%;">
                            <h:outputLabel value="Total" />
                        </td>
                        <td  class="totalsBlock" style="text-align: right!important; width: 40%; padding-right: 30px;">
                            <h:outputLabel value="#{cc.attrs.bill.netTotal + cc.attrs.bill.discount}" >
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </td>
                    </tr>
                    <tr>
                        <td  class="totalsBlock" style="text-align: left;">
                            <h:outputLabel  rendered="#{cc.attrs.bill.discount ne 0.0}" value="Discount (#{cc.attrs.bill.paymentScheme.discountPercentForPharmacy} %)" style="font-weight: bolder!important;"/>
                        </td>
                        <td  class="totalsBlock" style="text-align: right!important; ; padding-right: 30px;">
                            <h:outputLabel rendered="#{cc.attrs.bill.discount ne 0.0}"   value="#{-cc.attrs.bill.discount}" style="font-weight: bolder!important;" >
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </td>
                    </tr>
                    <tr>
                        <td  class="totalsBlock" style="text-align: left;">
                            <h:outputLabel  rendered="#{cc.attrs.bill.discount ne 0.0}"    value="Net Total" />
                        </td>
                        <td  class="totalsBlock" style="text-align: right!important;font-weight: bold; ; padding-right: 30px; ">
                            <h:outputLabel  rendered="#{cc.attrs.bill.discount ne 0.0}"    value="#{cc.attrs.bill.netTotal}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </td>
                    </tr>
                    <tr>
                        <td  class="totalsBlock" style="text-align: left;">
                            <h:outputLabel   value="Number of Items Count" />
                        </td>
                        <td  class="totalsBlock">
                            <h:outputLabel   value="#{cc.attrs.bill.billItems.size()}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </td>
                    </tr>


                </table>

            </div>


            <div class="footer">
                <br/>
                THANK YOU.<br/>
                Returns Accepted only within 3 days.
            </div>



        </div>
    </cc:implementation>
</html>